﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HNQXYJ.Model;
using HNQXYJ.BLL;
namespace HNQXYJ.HN_User
{
    public partial class UserAddRankLevel : System.Web.UI.Page
    {
       
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void add_Click(object sender, ImageClickEventArgs e)
        {
            Users user = new Users();
            user.UserName = this.txtUserName.Text;
            user.TrueName = this.txtTrueName.Text;
            user.Password = UsersBLL.GetMD5(this.txtPwd.Text.Trim());
            if (this.HidCountyCode.Value == "")
            {
                //市级管理员
                user.RankName = this.HidCityName.Value;
                user.RankLevel = this.HidCityCode.Value;
            }
            else
            {
                //县级管理员
                user.RankName = this.HidCityName.Value + this.HidCountyName.Value;
                user.RankLevel = this.HidCountyCode.Value;
            }
            user.TouchMethod = this.txtTouchMehtod.Text;
            user.AddDate = DateTime.Now;
            user.ErrTimes = 0;
            user.Notes = txtNotes.Text;

            int res = new UsersBLL().AddNew(user);
            if (res > 0)
            {
                Response.Redirect("UserMgrRankLevel.aspx");
            }     
        }

        protected void reset_Click(object sender, ImageClickEventArgs e)
        {
            Response.Redirect("UserMgrRankLevel.aspx");
        }

    }
}